/*
 * @Author: your name
 * @Date: 2020-04-28 20:07:32
 * @LastEditTime: 2020-04-30 11:42:01
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \myprojectg:\coding\yjw\src\service\yanjiubaogao.js
 */
import Api from "./api";
import qs from 'qs'
import { APIURL, sliceHomeHotModel} from "utils/base";
class YanJiuBaoGaoApis extends Api {
  constructor() {
    super();
  }
  //获取研究报告
  /**
   * @Author: yushanghui
   * @description: modelType:2, reportType:1 表示查询的是：一张图看懂系列报告的行业分类和 reportType：2表示查询的是精品专题报告分类和列表
   * @param {Sting} reportType
   * @Date: 2020-04-28 14:14:57
   */
  getBaoGaoList (reportType) {
   let json = {
      modelType:2,
     reportType: reportType
    }
    return this.post(`${APIURL()}/backend/report/queryReport`, qs.stringify(json)).then(({ data }) => {
      return data
    });
  }
  //获取研究报告列表
  getBaoGaoType (json) {
    return this.post(`${APIURL()}/backend/report/queryReportWithReportType`, qs.stringify(json)).then(({ data }) => {
      return data
    });
  }
  //获取精品专题报告详情
  getBaoGaoDetail (json) {
    return this.post(`${APIURL()}/backend/report/queryReportDetailWithReportType`, qs.stringify(json)).then(({ data }) => {
      let detail = data.report
      return detail;
    });
  }
  //获取热门研究报告
  getHotBaoGaoInfo (reportClassification) {
    return this.post(`${APIURL()}/backend/report/queryHotReportWithSort`, qs.stringify({ reportClassification})).then(({ data }) => {
      //进行截取
      let records = data.list.records
      records= records.slice(0, 5);
      return sliceHomeHotModel(records)
    });
  }
  

}

export default new YanJiuBaoGaoApis();
